<?php
	// 加载公共文件
	include_once('../public/config/config.php');
	include_once('../public/config/sql.php');

	// 实例化对象
	$obj = new sql($info);

	// 构建SQL语句，发送执行
	$sql = "select id,username,state from article_classify";

	$rows = $obj->db_select($sql, true);

?>
<!DOCTYPE html>
<html>
<head>
	<title></title>
</head>
<body>	
	<div class="myIframe_box">
		<div class="iframe_title">
			<div class="iframe_title_c">
				<div class="title_c_l">
					<span>新增文章</span>
				</div>
			</div>
		</div>
		<div class="title_b_hint"><button onclick="return history.back(-1);">返回上一级</button></div>

		<div class="middle_box">
			<div class="middle_center">
				<form action="./pose/article_insertAction.php" method="post" class="myform" enctype="multipart/form-data">
					<div class="file_box clearBoth">
						<lable>封面</lable>
						<p><input type="file" name="file"><span>文件上传</span></p>
						<p id="arrImg"><img src="./public/image/banner2.jpg" alt=""></p>
					</div>
					<p>
						<lable>文章分类</lable>
						<select name="cid" id="">
							<?php
								foreach($rows as $val){

									if($val['state'] != '1'){

										echo '<option value="'. $val['id'] .'">'.$val['username'].'</option>';
									}
								}
							?>
						</select>
					</p>
					<p>
						<lable>轮播状态</lable>
						<a id="slide" href="javascript:;"><span>禁</span><input class="slideV" type="hidden" name="slide" value="0"></a>
					</p>
					<p>
						<lable>标题</lable>
						<input type="text" name="users">
					</p>
					<p>
						<lable>作者</lable>
						<input type="text" name="author">
					</p>
					<p>
						<lable>描述</lable>
						<textarea name="describe" id="" cols="30" rows="10"></textarea>
					</p>
					<p>
						<lable>内容</lable>
						<textarea name="content" id="" cols="30" rows="10"></textarea>
					</p>
					<input id="btn" type="submit" value="保存">
				</form>
			</div>
		</div>
	</div>
</body>
</html>
<script type="text/javascript">
	var slide = document.getElementById('slide'),
		span  = slide.getElementsByTagName('span')[0],
		slideV  = slide.getElementsByClassName('slideV')[0];

	if(slideV.value === '0'){
		
		span.style.marginLeft = '0';
		span.innerHTML = '禁';	
	}else{

		span.style.marginLeft = '30px';
		span.innerHTML = '开';
	}

	slide.onclick = function(){

		slideFunc();
	}

	function slideFunc(){

		if(slideV.value === '0'){

			span.style.marginLeft = '30px';
			span.innerHTML = '开';
			slideV.value = '1';
		}else{

			span.style.marginLeft = '0';
			span.innerHTML = '禁';
			slideV.value = '0';
		}
	}
</script>